home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 090 / pctj8408.arc / RANDOM2.BAS < prev    next >
BASIC Source File  |  1984-05-11  |  1KB  |  43 lines

  1. 10 '         Correlated variable display
  2. 20 '         showing problems with RND function
  3. 30 '         -by P. F. Hultquist, 1983
  4. 40 '
  5. 50 DIM ARRAY(50) : SCREEN 2 : CLS : KEY OFF
  6. 60 '         W,X,Y,Z are obtained from successive calls to RND
  7. 70 '         and then used to generate coordinates of display
  8. 80 '         points
  9. 85 GOSUB 1000
  10. 90 FOR K = 1 TO 5000
  11. 100 GOSUB 1100
  12. 101 W = V : GOSUB 1100
  13. 102 X = V : GOSUB 1100
  14. 103 Y = V : GOSUB 1100
  15. 104 Z = V
  16. 110 I = 100 + 425*(.3*W + .4*X + .3*Y)
  17. 120 J = 25 + 150*(.3*X + .4*Y + .3*Z)
  18. 130 PSET(I,J)
  19. 140 NEXT K
  20. 150 '        Print label for display
  21. 160 LINE (25,10)-(600,10)
  22. 170 LINE -(600,190)
  23. 180 LINE -(25,190)
  24. 190 LINE -(25,10)
  25. 200 LOCATE 23,35
  26. 210 PRINT "Figure 2"
  27. 220 GOTO 2000
  28. 1000 '        Modification of random number generation
  29. 1010 '        to introduce "randomizer"
  30. 1020 FOR K = 1 TO 50
  31. 1030 ARRAY(K) = RND
  32. 1040 NEXT K
  33. 1050 '        This loads the array with random numbers
  34. 1060 '        to be used in the randomization
  35. 1070 SPARE = RND
  36. 1080 RETURN
  37. 1090 '        Enter here on succeeding calls
  38. 1100 KA = INT(SPARE*50) + 1
  39. 1110 SPARE = ARRAY(KA)
  40. 1120 V = SPARE : ARRAY(KA) = RND
  41. 1130 RETURN
  42. 2000 END
  43.